<?php

/**
 * 
 * 编辑市区的名称信息
 * 
 */

include('./config/db.php');
$pgdb = new PGDB;

// 1.获取数据
if(isset($_POST) && !empty($_POST['id']&& !empty($_POST['area'] ))){
    // 2. 获取区的ID
    $id = $_POST['id'];
    $area = $_POST['area'];
    // 3. 修改区
    $edit_area_sql = "update public.management_t set name = '$area' where id =$id";
    $res = @$pgdb->query($edit_area_sql);
    // 4. 返回结果
    if(!$res){
        die(json_encode(array('Code'=>0x000002,'Msg'=>'修改区失败')));
    }
    die(json_encode(array('Code'=>0x000000,'Msg'=>'修改区成功')));
}else{
    die(json_encode(array('Code'=>0x000001,'Msg'=>'没有数据上传')));
}